<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<html>
<body>
<script language="javascript" type="text/javascript">
	
	function deleteItem(id) {
	
		var item = "#item"+id;
		var count = "#count"+id;
		var type ="#type"+id;
		$(item).val("");
		$(count).val(1);
		$(type).val(7);
	}
	
</script>


<form class="form-search" action="list.do" method="post">
  <div><input type="radio" name="sendType" value="0" />全服所有人
  <input type="radio" name="sendType" value="2" style="margin-left:40px;"  /> 男性
  <input type="radio" name="sendType" value="3"  style="margin-left:40px;" /> 女性
  <input type="radio" name="sendType" value="1" style="margin-left:40px;" checked />收件人id: <textarea name="playerIds" rows=6 style="margin-left:30px;width:120px;"></textarea> </div>
  <div style="margin-top:5px;"> 邮件标题: <input name="title" style="margin-left:40px;"/> （10字内） </div>
  <div style="margin-top:5px;"> 邮件内容: <textarea name="comtent" rows=4 style="margin-left:40px;width:500px;"> </textarea> </div>
  <div style="margin-top:5px;"> 过期时间: 
  	<div class="datepicker input-append" style="margin-left:40px;">
	    <input data-format="yyyy-MM-dd HH:mm:ss" type="text" name="overTime" value="${overTime}" readonly="readonly" style="cursor:text"></input>
	    <span class="add-on">
	      <i data-time-icon="icon-time" data-date-icon="icon-calendar">
	      </i>
	    </span>
  	</div>&nbsp;&nbsp;<font color="red">(默认30天后过期)</font>
  </div>
  
  <div style="margin-top:20px;">选择物品id: 
	  <table> 
	  	<tr>
	  		<td>1: </td>
	  		<td><input name="item" id="item1"/> </td>
	  		<td>  数量  </td>
	  		<td> <input name="count" style="width:30px" value="1" id="count1"/></td>
	  		<td> 使用期限	</td>
	  		<td> 
			  <select class="input-small" name="times" id="type1">
			  	<option value="7" id="times" selected > 7天  </option>
			  	<option value="15" id="times"> 15天</option>
			  	<option value="30" id="times"> 30天</option>
			  </select>
		    </td>
	  		<td> <input type="button" value="清除" id="remove1" onclick="deleteItem(1)" /></td>
	  	</tr>
	  	<tr>
	  		<td>2: </td>
	  		<td><input name="item" id="item2"/> </td>
	  		<td>  数量       </td>
	  		<td> <input name="count" style="width:30px" value="1" id="count2"/></td>
	  		<td> 使用期限	</td>
	  		<td> 
			  <select class="input-small" name="times" id="type2">
			  	<option value="7" id="times" selected > 7天  </option>
			  	<option value="15" id="times"> 15天</option>
			  	<option value="30" id="times"> 30天</option>
			  </select>
		    </td>
	  		<td> <input type="button" value="清除" id="remove2" onclick="deleteItem(2)"/></td>
	  	</tr>
	  	<tr>
	  		<td>3: </td>
	  		<td><input name="item" id="item3"/> </td>
	  		<td> 数量  </td>
	  		<td> <input name="count" style="width:30px" value="1" id="count3"/></td>
	  		<td> 使用期限	</td>
	  		<td> 
			  <select class="input-small" name="times" id="type3">
			  	<option value="7" id="times" selected > 7天  </option>
			  	<option value="15" id="times"> 15天</option>
			  	<option value="30" id="times"> 30天</option>
			  </select>
		    </td>
	  		<td> <input type="button" value="清除" id="remove3" onclick="deleteItem(3)"/></td>
	  	</tr>
	  	<tr>
	  		<td>4: </td>
	  		<td><input name="item" id="item4"/> </td>
	  		<td>  数量  </td>
	  		<td> <input name="count" style="width:30px" value="1" id="count4"/></td>
	  		<td> 使用期限	</td>
	  		<td> 
			  <select class="input-small" name="times" id="type4">
			  	<option value="7" id="times" selected > 7天  </option>
			  	<option value="15" id="times"> 15天</option>
			  	<option value="30" id="times"> 30天</option>
			  </select>
		    </td>
	  		<td> <input type="button" value="清除" id="remove4" onclick="deleteItem(4)"/></td>
	  	</tr>
	  	<tr>
	  		<td>5: </td>
	  		<td><input name="item" id="item5"/> </td>
	  		<td>  数量  </td>
	  		<td> <input name="count" style="width:30px" value="1" id="count5" /></td>
	  		<td> 使用期限	</td>
	  		<td> 
			  <select class="input-small" name="times" id="type5">
			  	<option value="7" id="times" selected > 7天  </option>
			  	<option value="15" id="times"> 15天</option>
			  	<option value="30" id="times"> 30天</option>
			  </select>
		    </td>
	  		<td> <input type="button" value="清除" id="remove5" onclick="deleteItem(5)"/></td>
	  	</tr>
	  </table>
  </div>
  <br/>
  <button type="submit" class="btn">发送</button>
</form>
<table class="table table-bordered" style="word-break:break-all;" >
  <thead>
    <tr>
      <th>发送时间</th>
      <th>邮件标题</th>
      <th>内容</th>
      <th>物品</th>
      <th>收件人</th>
      <th>过期时间</th>
      <th>操作</th>
      <th>操作人</th>
    </tr>
  </thead>
  <tbody>
  <!--<td><tags:user id="${player.comtent}"/></td>-->
  <c:forEach var="player" items="${list}">
    <tr>
      <td style="width:80px;overflow:hidden;">${player.sendTime}</td>
      <td style="width:100px;overflow:hidden;">${player.title}</td>
      <td style="width:300px;overflow:hidden;">${player.comtent}</td>
      <td style="width:250px;overflow:hidden;">${player.attachment}</td>
      <c:if test="${player.type==0}">
	      <td style="width:250px;overflow:hidden;">全服所有人</td>
      </c:if>
      <c:if test="${player.type==1}">
	      <td style="width:250px;overflow:hidden;">${player.playerIds}</td>
      </c:if>
      <c:if test="${player.type==2}">
	      <td style="width:250px;overflow:hidden;" >所有男性</td>
      </c:if>
      <c:if test="${player.type==3}">
	      <td style="width:250px;overflow:hidden;" >所有女性</td>
      </c:if>
      <td style="width:80px;overflow:hidden;">${player.overTime}</td>
      <td style="width:50px;overflow:hidden;"> <a href="delMail.do?mailid=${player.mailId}" onclick="return confirm('你确定要删除邮件\'${player.title}\'吗？');"> 删除  </a></td>
      <td style="width:50px;overflow:hidden;" >${player.operator}</td>
    </tr>
  </c:forEach>
  </tbody>
</table>
<tags:page1 page="${page}" pageSize="${pageSize }" total="${total }" url="?page="/>
</body>
</html>